#include <iostream>
#include <string>

using namespace std;

string slice(const std::string& s, int begin, int end, int step) {
    string res;
    if (step == 0) return res;
    for (int i = begin; i < s.size() && i < end; i += step) res += s[i];
    return res;
}

int main() {
    string s1;
    int b, e, s;
    cin >> s1 >> b >> e >> s;
    cout << slice(s1, b, e, s);
}